"""
单元测试 | 示例
"""

from fastapi.testclient import TestClient

from main import app


def test_demo(mock_db):
    # 模拟插入数据到 MongoDB
    mock_db["user_user"].insert_one({"your_test_data": "example"})

    # 使用 FastAPI 测试客户端来测试创建数据的 API 端点
    with TestClient(app) as client:
        response = client.post("/your_create_data_endpoint", json={"your_test_data": "example"})
        assert response.status_code == 200
        assert response.json() == {"message": "Data created successfully"}
